﻿using Common;
using MainService.Controllers.Extend;
using ResponseModel;
using System;
using System.Web.Http;

namespace MainService.Controllers
{
    /// <summary>
    /// Nginx控制器
    /// </summary>
    public class NginxController : BaseApiController
    {
        /// <summary>
        /// 获取Nginx端口号（测试用）
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [HttpPost]
        public ResultModel GetNginxPort()
        {
            ResultModel resultModel = new ResultModel();

            try
            {
                resultModel.Pass = true;
                resultModel.Msg = "当前访问的服务器ip:" + RequestBase.ServerVariables["SERVER_NAME"] + ":" + RequestBase.ServerVariables["SERVER_PORT"];//服务器端口 
            }
            catch (Exception ex)
            {
                LogHelper.Error("报错：" + ex);
                resultModel.Msg = "报错：" + ex;
            }

            return resultModel;
        }
    }
}
